﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompanyManage.aspx.cs"
    Inherits="NJL.WebManage.Company.CompanyManage" %>

<%@ Import Namespace="Royalsoft.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        #enlarge_images
        {
            position: absolute;
            display: none;
            z-index: 2;
            border: 5px solid #f4f4f4;
        }
        .onshow
        {
            background: #d6e6f5;
        }
    </style>
    <script src="/Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="/Scripts/js/jquery.skygqbox.1.3.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#submitAdd').click(function () {
                var txtRemark = $('#txtRemark').val();
                if ($.trim(txtRemark).length == 0) {
                    alert('请输入备注信息哦');
                    return;
                }
            });
        });
        var addRemark = function (id) {
            var txtRemark = $('#txtRemark').val();
            $.ajax({
                type: 'post',
                url: '/Handle/Handler.ashx',
                data: { componyRemark: '' + id, content: '' + txtRemark },
                dateType: 'text',
                success: function (result) {
                    alert('提交成功');
                    $('#divRemark').skygqbox().hide();
                    location.reload();
                },
                error: function () {
                    alert('找不到资源');
                }

            });

        }
        function textboxSelect() {
            var checkbox = document.getElementsByName("cbxSingle");
            for (var i = 0; i < checkbox.length; i++) {
                checkbox[i].checked = !checkbox[i].checked;
            }
        }
        function checkCheckboxState() {
            var checkbox = document.getElementsByName("cbxSingle");
            var hiddenId = "";
            var count = 0;
            for (var i = 0; i < checkbox.length; i++) {
                if (checkbox[i].checked == true) {
                    hiddenId += checkbox[i].value + ",";
                    count++;
                }
            }
            if (count == 0) {
                alert('请选择您要删除的记录')
                return false;
            }
            else {
                if (window.confirm("删除该信息时则将该信息对应的服务信息也删除，您确定要删除吗？")) {
                    hiddenId = hiddenId.substring(0, hiddenId.length - 1);
                    document.getElementById("<%=HSelectId.ClientID %>").value = hiddenId;
                }
                else {
                    return false;
                }
            }
        }
        var iTop = (window.screen.availHeight - 30 - 500) / 2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth - 10 - 800) / 2; //获得窗口的水平位置;
        function tickvalue(id) {
            // var iframesrc = document.getElementById("tick").src = "/Attractions/TicketInfo.aspx?id=" + id + "&typeId=2";
            window.open("/Attractions/TicketInfo.aspx?id=" + id + "&typeId=2", "tickinfo", "height=500, width=800,top=" + iTop + ",left=" + iLeft + ",toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
        }
        function ShopClaim(id) {
            //var iframesrc = document.getElementById("tick").src = "ShopClaimManage.aspx?id=" + id;
            window.open("/Company/ShopClaimManage.aspx?id=" + id, "tickinfo", "height=500, width=800,top=" + iTop + ",left=" + iLeft + ",toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
        }
        //服务
        var service = function (id) {
            // var iframesrc = document.getElementById("tick").src = "/Company/CompanyService.aspx?id=" + id;
            window.open("/Company/CompanyService.aspx?id=" + id, "tickinfo", "height=500, width=800,top=" + iTop + ",left=" + iLeft + ",toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
        }
        //活动
        var active = function (id) {
            // var iframesrc = document.getElementById("tick").src = "/Company/AddActivity.aspx?id=" + id;
            window.open("/Company/AddActivity.aspx?id=" + id, "tickinfo", "height=500, width=800,top=" + iTop + ",left=" + iLeft + ",toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no");
        }
        
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="main_content fr">
        <div class="gray_bd">
            <div class="table_title">
                <asp:Literal ID="litTitle" runat="server"></asp:Literal>管理
            </div>
            <%
                if (WEBSITE_CODE == "1")
                {
            %>
            <div style="height: auto">
                <%
                    if (Request.QueryString["areacode"] == null)
                    {
                %>
                <a style="font-weight: bold" href="?typeid=<%=Request.QueryString["typeid"] %>&typename=<%=Request.QueryString["typename"] %>">
                    全部</a>
                <%
                    }
                    else
                    { 
                %>
                <a href="?typeid=<%=Request.QueryString["typeid"] %>&typename=<%=Request.QueryString["typename"] %>">
                    全部</a>
                <%
                    }

                    for (int i = 1; i < ListArea.Count; i++)
                    {
                        if (Request.QueryString["areacode"] == ListArea[i].AREA_CODE)
                        {
                %>
                <a style="font-weight: bold" href="?typeid=<%=Request.QueryString["typeid"] %>&typename=<%=Request.QueryString["typename"] %>&areacode=<%=ListArea[i].AREA_CODE %>">
                    <%=ListArea[i].AREA_NAME%>[
                    <%
                        if (USER_TYPE_CODE == "2")
                        {
                            Response.Write(GetListCountByAreaCode(ListArea[i].AREA_CODE, "").ToString());
                        }
                        else
                        {
                            Response.Write(GetListCountByAreaCode(ListArea[i].AREA_CODE, "").ToString() + "/<span style=\"color:#33aa00;\">" + GetListCountByAreaCode(ListArea[i].AREA_CODE, "1").ToString() + "</span>/<span style=\"color:#ff0000;\">" + GetListCountByAreaCode(ListArea[i].AREA_CODE, "0").ToString() + "</span>/");
                        }
                    %>] </a>
                <% 
}
                        else
                        { 
                %>
                <a href="?typeid=<%=Request.QueryString["typeid"] %>&typename=<%=Request.QueryString["typename"] %>&areacode=<%=ListArea[i].AREA_CODE %>">
                    <%=ListArea[i].AREA_NAME%>[
                    <%
                        if (USER_TYPE_CODE == "2")
                        {
                            Response.Write(GetListCountByAreaCode(ListArea[i].AREA_CODE, "").ToString());
                        }
                        else
                        {
                            Response.Write(GetListCountByAreaCode(ListArea[i].AREA_CODE, "").ToString() + "/<span style=\"color:#33aa00;\">" + GetListCountByAreaCode(ListArea[i].AREA_CODE, "1").ToString() + "</span>/<span style=\"color:#ff0000;\">" + GetListCountByAreaCode(ListArea[i].AREA_CODE, "0").ToString() + "</span>/");
                        }
                    %>] </a>
                <% 
                    }
                    }
                %>
            </div>
            <%
                }
            %>
            <div class="table_title">
                企业名称：<asp:TextBox ID="txtKey" runat="server" Width="200"></asp:TextBox>
                &nbsp;认领：<asp:DropDownList ID="ddlClaim" runat="server">
                    <asp:ListItem Value="-1" Selected="True">---</asp:ListItem>
                    <asp:ListItem Value="1">已认领</asp:ListItem>
                    <asp:ListItem Value="0">未认领</asp:ListItem>
                </asp:DropDownList>
                &nbsp;预订：<asp:DropDownList ID="ddlBook" runat="server">
                    <asp:ListItem Value="-1" Selected="True">---</asp:ListItem>
                    <asp:ListItem Value="1">已开通</asp:ListItem>
                    <asp:ListItem Value="0">未开通</asp:ListItem>
                </asp:DropDownList>
                &nbsp;<asp:Button ID="btnSearch" runat="server" Text="查 询" OnClick="btnSearch_Click" />
            </div>
            <div class="pad5px">
                <div class="border_b_dotted">
                    <table class="tableliststyle" cellspacing="0" rules="all" border="1" id="demo">
                        <tr class="gridheader">
                            <th style="width: 40px;">
                                <input id="cbxAll" type="checkbox" onclick="textboxSelect()" />
                            </th>
                            <th>
                                序号
                            </th>
                            <th>
                                企业名称
                            </th>
                            <th>
                                图片
                            </th>
                            <th>
                                手机
                            </th>
                            <th>
                                电话
                            </th>
                            <th>
                                QQ
                            </th>
                            <th>
                                创建时间
                            </th>
                            <th>
                                认领信息
                            </th>
                            <th>
                                认领
                            </th>
                            <th>
                                排序
                            </th>
                            <th>
                                服务
                            </th>
                            <th>
                                活动
                            </th>
                            <th>
                                订票
                            </th>
                            <th>
                                审核
                            </th>
                            <th>
                                编辑
                            </th>
                            <th>
                                删除
                            </th>
                            <th style="display:none">
                                备注
                            </th>
                        </tr>
                        <asp:Repeater ID="rptUserList" runat="server" OnItemCommand="rptUserList_ItemCommand"
                            OnItemDataBound="rptUserList_ItemDataBound">
                            <ItemTemplate>
                                <tr onmouseover="this.className='onshow'" onmouseout="this.className=''" class="">
                                    <td align="center">
                                        <input id="<%#Eval("ID") %>" type="checkbox" value="<%#Eval("ID") %>" name="cbxSingle" />
                                    </td>
                                    <td align="center">
                                        <asp:Literal ID="litNum" runat="server"></asp:Literal>
                                    </td>
                                    <td align="left" title="<%#Eval("COMPANY_NAME") %>">
                                        <%#PageValidate.SqlText(Eval("COMPANY_NAME").ToString(), 11)%>
                                    </td>
                                    <td>
                                        <asp:Image ID="Image1" runat="server" Width="60px" Height="45px" imagecard="pic" />
                                    </td>
                                    <td align="center">
                                        <%#Eval("MOBILE")%>
                                    </td>
                                    <td align="center">
                                        <%#Eval("TEL")%>
                                    </td>
                                    <td align="center">
                                        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=<%#Eval("QQ") %>&site=qq&menu=yes">
                                            <img border="0" src="http://wpa.qq.com/pa?p=2:<%#Eval("QQ") %>:45" alt="点击这里给我发消息"
                                                title="点击这里给我发消息"></a>
                                    </td>
                                    <td align="center">
                                        <%#Eval("CREATE_DATE_TIME", "{0:yyyy-MM-dd}")%>
                                    </td>
                                    <td align="center">
                                        <a href="javascript:ShopClaim('<%#Eval("ID") %>')">认领信息</a>
                                    </td>
                                    <td align="center">
                                        <asp:ImageButton ID="imgbtnClaim" runat="server" CommandName="imgbtnClaim" CommandArgument='<%#Eval("ID") %>'
                                            AlternateText='<%#Eval("CLAIM_STATE") %>' />
                                    </td>
                                    <td align="center">
                                        <%#Eval("SORT")%>
                                    </td>
                                    <td align="center">
                                        <a href="javascript:service('<%#Eval("ID") %>')">服务</a>
                                    </td>
                                    <td align="center">
                                        <a href="javascript:active('<%#Eval("ID") %>')">活动</a>
                                    </td>
                                    <td align="center">
                                        <a href="javascript:tickvalue('<%#Eval("ID") %>')">订票</a>
                                    </td>
                                    <%
                                        if (WEBSITE_CODE == "1" && USER_TYPE_CODE == "1")
                                        {
                                
                                    %>
                                    <td align="center" style="display: none">
                                        <asp:ImageButton ID="imgbtn1" runat="server" CommandName="imgbtn1" CommandArgument='<%#Eval("ID") %>'
                                            AlternateText='<%#Eval("SHOW_STATE") %>' />
                                    </td>
                                    <%
                                        }
                                    %>
                                    <td align="center">
                                        <asp:ImageButton ID="imgbtn2" runat="server" CommandName="imgbtn2" CommandArgument='<%#Eval("ID") %>'
                                            AlternateText='<%#Eval("AUDIT_STATE") %>' />
                                    </td>
                                    <td align="center">
                                        <a href="EditCompany.aspx?id=<%#Eval("ID") %>&typeid=<%=Request.QueryString["typeid"] %>&typeName=<%=Request.QueryString["typeName"]%>&QQ=<%#Eval("QQ1") %>&Page=<%=ViewState["pager"]%>">
                                            编辑</a>
                                    </td>
                                    <td align="center">
                                        <asp:LinkButton ID="lbtnDel" runat="server" CommandName="Del" CommandArgument='<%#Eval("ID") %>'
                                            OnClientClick="return confirm('删除该信息时则将该信息对应的服务信息也删除，您确定要删除吗?')">删除</asp:LinkButton>
                                    </td>
                                    <td style="display:none">
                                        <a href="javascript:void(0)">备注</a>
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    <div style="text-align: left; margin-top: 5px;">
                        <asp:Button ID="btnDel" runat="server" Text="删除" OnClientClick="return checkCheckboxState()"
                            OnClick="btnDel_Click1" />
                    </div>
                </div>
                <div style="text-align: center">
                    共
                    <asp:Literal ID="lit" runat="server"></asp:Literal>
                    条记录&nbsp;&nbsp;&nbsp;&nbsp; 共
                    <asp:Literal ID="litAllPage" runat="server"></asp:Literal>
                    页&nbsp;&nbsp;&nbsp;&nbsp; 第
                    <asp:Literal ID="litCurrentPage" runat="server"></asp:Literal>
                    页
                    <asp:LinkButton ID="lbtnFirst" runat="server" OnClick="lbtnFirst_Click">首页</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="lbtnPrev" runat="server" OnClick="lbtnPrev_Click">上一页</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="lbtnNext" runat="server" OnClick="lbtnNext_Click">下一页</asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="lbtnEnd" runat="server" OnClick="lbtnEnd_Click">末页</asp:LinkButton>
                    跳转到第
                    <asp:TextBox ID="txtPage" runat="server" Width="32px" MaxLength="8" Style="text-align: center"></asp:TextBox>&nbsp;页&nbsp;
                    <asp:Button ID="btnRir" runat="server" Text="确定" OnClick="btnRir_Click" />
                </div>
            </div>
        </div>
    </div>
    <div id="win" style="padding: 10px; display: none; width: 1000px;">
        <iframe id="tick" scrolling="auto" width="100%" height="100%"></iframe>
    </div>
    <div id="divRemark" style="display:none">
        <p>
            <textarea id="txtRemark" cols="40" rows="6"></textarea>
        </p>
        <p style="text-align: center">
            <input id="submitAdd" type="submit" value="备注" />
        </p>
    </div>
    <asp:HiddenField ID="HSelectId" runat="server" />
    <div id="enlarge_images">
    </div>
    <script type="text/javascript">
        var demo = document.getElementById("demo");
        var gg = demo.getElementsByTagName("img");
        var ei = document.getElementById("enlarge_images");
        for (i = 0; i < gg.length; i++) {
            var ts = gg[i];
            if (ts.attributes['imagecard']) {
                ts.onmousemove = function (event) {
                    event = event || window.event;
                    ei.style.display = "block";
                    ei.innerHTML = '<img src="' + this.src + '" />';
                    ei.style.top = document.body.scrollTop + event.clientY + 10 + "px";
                    ei.style.left = document.body.scrollLeft + event.clientX + 10 + "px";
                }
                ts.onmouseout = function () {
                    ei.innerHTML = "";
                    ei.style.display = "none";
                }
                ts.onclick = function () {
                    window.open(this.src);
                }
            }

        }
    </script>
    </form>
</body>
</html>
